{extend name="layout:base" /}

{block name="content"}
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form">
                <input type="hidden" name="id" value="{$article.id}">
                <div class="layui-row layui-col-space10 layui-form-item">
                    <label class="layui-form-label">推广平台</label>
                    <div class="layui-input-block">
                        <input type="radio" name="typeid" value="1" title="百度" {if condition="$article.typeid==1"}checked{/if}>
                        <input type="radio" name="typeid" value="2" title="360" {if condition="$article.typeid==2" }checked{/if}>
                        <input type="radio" name="typeid" value="3" title="百度移动端" {if condition="$article.typeid==3" }checked{/if}>
                        <input type="radio" name="typeid" value="4" title="sogou" {if condition="$article.typeid==4" }checked{/if}>
                        <input type="radio" name="typeid" value="5" title="神马" {if condition="$article.typeid==5" }checked{/if}>
                    </div>
                </div>

                <div class="layui-row layui-col-space10 layui-form-item">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-input-inline">
                        <input type="text" name="name" value="{$article.name}" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-row layui-col-space10 layui-form-item">
                        <label class="layui-form-label">首页价格</label>
                        <div class="layui-input-inline">
                            <input type="text" name="money_one" value="{$article.money_one}" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                </div>
                <div class="layui-row layui-col-space10 layui-form-item">
                        <label class="layui-form-label">二页价格</label>
                        <div class="layui-input-inline">
                            <input type="text" name="money_two" value="{$article.money_two}" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                </div>


                <div class="layui-form-item layui-layout-admin">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0;">
                            <button class="layui-btn" lay-submit="" lay-filter="btnSave">保存</button>
                            <a class="layui-btn layui-btn-primary" href="javascript:parent.location.reload();">返回</a>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>

    layui.config({
        base: '__STATIC__/layuiadmin/' //静态资源所在路径
    }).extend({
        index: '/lib/index' //主入口模块
    }).use(['index', 'table', 'jquery', 'layer', 'form'], function () {
        var $ = layui.$, form = layui.form;

        form.on('submit(btnSave)', function (data) {
            $.post("{:url('edit')}", data.field, function (result) {
                console.log(result);
                if (result['code'] == 0) {
                    layer.msg(result['msg'], {icon: 1, time: 1000}, function () {
                        parent.location.reload();
                    });
                } else {
                    layer.msg(result['msg'], {icon: 3, time: 3000});
                }
            });
            return false;
        });
    });

</script>
{/block}